home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / asmutil / ps18a12.zip / A18.DOC < prev    next >
Text File  |  1987-03-15  |  38KB  |  1,100 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.                              PseudoSam 18 Assembler Manual V1.2.02
  12.                              Copyright(c) 1986 PseudoCode
  13.  
  14.  
  15.  
  16.  
  17.  
  18. Disclaimer:
  19.  
  20.             PseudoSam 18 is distributed as is, with no guarantee that it
  21.             will work correctly in all situations.  In no event will the
  22.             Author be liable for any damages, including lost profits,
  23.             lost savings or other incidental or consequential damages
  24.             arising out of the use of or inability to use these
  25.             programs, even if the Author has been advised of the
  26.             possibility of such damages, or for any claim by any other
  27.             party.
  28.  
  29.             It is the users reponsibility to back up all important files!
  30.  
  31.             See copyright information in appendix B
  32.  
  33.  
  34.  
  35.  
  36.  
  37.                          Table of Contents
  38.  
  39. Chapter 1  PseudoSam 18 assembler vs. the RCA assembler.
  40.  
  41. Chapter 2  Running the assembler program.
  42.  
  43. Chapter 3  Assembler statement syntax.
  44.  
  45. Chapter 4  Data types.
  46.  
  47. Chapter 5  Expressions.
  48.  
  49. Chapter 6  Assembler Directives.
  50.   (also known as assembler pseudo-opcodes, or pseudo-ops)
  51.  
  52. Appendix A      ASCII character set.
  53.  
  54. Appendix B      Copyright and registration information.
  55.  
  56. Appendix C      Description of Files.
  57.  
  58. Appendix D      Bug Reporting Procedure.
  59.  
  60. Appendix E      Using PseudoSam 18 on "Compatible" Systems.
  61.  
  62.  
  63.  
  64. Chapter 1 PseudoSam 18 assembler vs. the RCA assembler
  65.  
  66.      All PseudoSam(Pseudo brand Symbolic AsseMbler) assemblers conform to
  67.      a common syntax based on the UNIX system V assembler syntax. By
  68.      conforming to this Pseudo standard, conflicts with the manufacturers
  69.      syntax are created.  Below is a brief and incomplete list of those
  70.      conflicts.
  71.  
  72.       RCA format  level 1                 PseudoSam format
  73.  
  74. <identifier> equ <expression>         .equ <identifier> , <expression>
  75.  
  76. <identifier> set <expression>         .set <identifier> , <expression>
  77.  
  78. Has Macro capability                  No Macro capability at this time
  79.  
  80. ..coments are delimited by            ;coments are delimited by
  81. .. two periods                        ; a single semicolon
  82.  
  83.  
  84. * The difference between the RCA and the PseudoSam name
  85.   of an assembler directive can be circumvented by the .opdef
  86.   directive.
  87.  
  88.   example
  89.  
  90.    .opdef  eject,.eject      ;defines eject to be synonymous with .eject
  91.  
  92. *  A file syn.asm is distributed with the assembler with some useful
  93.    redefinitions.
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104. Unix system V is a trademark of AT & T.
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112. Chapter 2  Running the assembler program
  113.  
  114. 1.  Command line switch setting and source file specification.
  115.  
  116.      Assuming the user has an assembly language source file called foo.asm
  117.      type the following command:
  118.  
  119. a18 foo
  120.  
  121.      The assembler will assemble the program foo.asm using the default
  122.      assembler switch settings. the following files will be generated
  123.      by the assembler:
  124.  
  125.      foo.lst   ;assembled listing shown the code conversion and
  126.                ; any errors that where discover by the assembler.
  127.  
  128.      foo.obj   ;assembled object code in Motorola Hex format.
  129.  
  130. **  for a list of switch setting see the .command assembler directive
  131.     description in chapter 6.
  132.  
  133. *** The assembler uses the following temporary file names.
  134.  
  135.     z0z0z0z0.tmp
  136.     z1z1z1z1.tmp
  137.  
  138.     ANY files with these names will be DESTROYED by the
  139.     by the assembler.
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147. Chapter 3  Assembler statement syntax
  148.  
  149. 1. Assembler Statements
  150.  
  151.      Assembler statements contain from zero to 4 fields as shown in
  152.      following.
  153.  
  154. <label> <opcode> <expressions> <comment>
  155.  
  156.      All fields are optional, but they must be in this order.
  157.  
  158. A.   Labels (<label>) are symbolic names that are assigned the starting
  159.      address of any code generated by the opcode and or expressions
  160.      of the line containing the label declaration.(see section 2).
  161.  
  162. B.   Operation codes(<opcode>) tell the assembler what machine instruction
  163.      to generate, or what assembler control function to perform.
  164.      The operation code also tells the assembler what expressions are
  165.      required to complete the machine instruction or assembler directive.
  166.      (see chapter 6).
  167.  
  168. C.   Expression requirements are set by the opcode(see the microprocessor
  169.      manufacturers reference manual or the assembler directives chapter
  170.      for individual opcode requirements).(see chapter 5).
  171.  
  172. D.   Comments are notes written by the programmer to explain what the
  173.      program is trying to accomplish. Comments generate no code.
  174.      (see section 3).
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182. 2.  Labels
  183.  
  184.      Labels can be unlimited in length, but only the first eight characters
  185.      are used to distinguish between them.  They must conform to the
  186.      following syntax.
  187.  
  188.      <label>  -> <identifier>':'
  189.  
  190.      <identifier> -> <alphabetic character> <identifier character string>
  191.  
  192.      <alphabetic character> -> character in the set ['A'..'Z', 'a'..'z', '.']
  193.  
  194.      <identifier character string> -> any sequence of characters from the
  195.                                       set ['A'..'Z','a'..'z', '.', '0'..'9']
  196.  
  197. example
  198. abc:                  ;label referred to as abc
  199. a c:                  ;not a valid label
  200.          foo:         ;label referred to as foo
  201. .123:                 ;label referred to as .123
  202.  
  203. * Case makes NO difference!
  204.  
  205. d:      ;is the same as
  206. D:
  207.  
  208.  
  209. 3.  Comments
  210.      Comments must start with a semi-colon ; and are terminated
  211.      by an end of line or file( <lf>(^J) or <sub>(^Z) ). An end
  212.      of line is inserted by typing the enter or return key by
  213.      most text editors.
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221. Chapter 4     Data types
  222.  
  223. 1.  Integers
  224.  
  225.     Integer constants can be specified in any of the following forms:
  226.  
  227. A.  Binary
  228.  
  229.     b'bb             ;bb=string of binary digits
  230.     B'bb
  231.  
  232. B.  Decimal
  233.  
  234.     ndd
  235.     d'dd             ;n=nozero decimal digit
  236.     D'dd             ;dd=string of decimal digits
  237.  
  238. C.  Octal
  239.  
  240.     0qq              ;qq=string of octal digits
  241.     o'qq
  242.     O'qq
  243.     q'qq
  244.     Q'qq
  245.  
  246. D.  Hexidecimal
  247.  
  248.     0x'hh            ;hh=string of hexidecimal digits
  249.     0X'hh
  250.     h'hh
  251.     H'hh
  252.     x'hh
  253.     X'hh
  254.  
  255.  
  256. Examples:
  257.  
  258.     077        ;octal number 77 = decimal 63
  259.     b'0101     ;binary number 101 = decimal 5
  260.     77         ;decimal number 77 = octal 115
  261.     h'ff       ;hexidecimal ff = decimal 255
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. 2.  Strings:
  269.  
  270.     Strings consist of a beginning quote " followed by any reasonable number
  271.     of characters followed by an ending quote ". Control characters and double
  272.     quotes " and backslash \ may not be used in strings directly.  These
  273.     special characters are included by using a special escape sequence which
  274.     the assembler translates into the appropriate ASCII code.
  275.  
  276. Note: Strings may not be used in expressions!
  277.       Although character constants may(see below).
  278.  
  279. Escape sequences
  280.   "\"" string containing "
  281.   "\\" string containing \
  282.   "\'" string containing '
  283.   "\0" string containing null
  284.   "\n" string containing linefeed
  285.   "\r" string containing carriage return
  286.   "\f" string containing formfeed
  287.   "\t" string containing horizontal tab
  288.   "\nnn" string containing the ASCII character who's code is o'nnn
  289.          (nnn are octal digits).
  290.   * see appendix A for ASCII codes.
  291.  
  292. 3.  Character Constants:
  293.  
  294.     Character constants consist of  a single quote ' followed by
  295.     a character or an escape sequence(see above) followed by a
  296.     single quote '.
  297.  
  298. example:
  299.    'A' = ASCII character value for the letter A = 65 (decimal);
  300.    '\''= ASCII character value for the character ' = 39 (decimal).
  301.  
  302. Character constants are treated as integers by the assembler and
  303. are valid where ever an integer value is valid.
  304.  
  305. example:
  306.    'A' + 1 = 66
  307.  
  308.   * see appendix A for ASCII codes.
  309.  
  310. 4.  Symbolic values
  311.  
  312.     Symbolic values are generally labels, but may be any identifier
  313.     assigned an integer value(using .set or .equ pseudo-ops).
  314.  
  315.     As a special case the symbol * when used as an operand in an
  316.     expression denotes the value of the location counter (the